<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>SASAPI</title><script src="../../../quicknav.js" type="text/javascript"></script><script><!--
document.quicknavBasePath="../../../index-files";
//--></script><link href="../../../style.css" title="JavaDoc" rel="stylesheet" type="text/css"/><link href="../../../unnatural.css" title="Unnatural" rel="alternate stylesheet" type="text/css"/><link href="../../../overview-summary.html" title="Overview" rel="top"/><meta name="generator" content="http://www.badgers-in-foil.co.uk/projects/as2api/"/></head><body><pre><span class="lineno" id="1">     1  </span>
<span class="lineno" id="2">     2  </span><span class="comment doc">/**
<span class="lineno" id="3">     3  </span> * com.sekati.utils.ArrayUtils
<span class="lineno" id="4">     4  </span> * @version 1.2.1
<span class="lineno" id="5">     5  </span> * @author jason m horwitz | sekati.com
<span class="lineno" id="6">     6  </span> * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
<span class="lineno" id="7">     7  </span> * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
<span class="lineno" id="8">     8  </span> */</span>
<span class="lineno" id="9">     9  </span> 
<span class="lineno" id="10">    10  </span><span class="comment doc">/**
<span class="lineno" id="11">    11  </span> * Static class wrapping various Array utilities.
<span class="lineno" id="12">    12  </span> */</span>
<span class="lineno" id="13">    13  </span><span class="key">class</span> com.sekati.utils.ArrayUtils {
<span class="lineno" id="14">    14  </span>
<span class="lineno" id="15">    15  </span>	<span class="comment doc">/**
<span class="lineno" id="16">    16  </span>	 * insert an element into array at a specific index
<span class="lineno" id="17">    17  </span>	 * @param a (Array)
<span class="lineno" id="18">    18  </span>	 * @param objElement (Object)
<span class="lineno" id="19">    19  </span>	 * @param nIndex (Number)
<span class="lineno" id="20">    20  </span>	 * @return Array
<span class="lineno" id="21">    21  </span>	 */</span>
<span class="lineno" id="22">    22  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> insert(a:Array, objElement:Object, nIndex:Number):Array {
<span class="lineno" id="23">    23  </span>		<span class="key">var</span> aA:Array = a.slice( <span class="num_const">0</span>, nIndex - <span class="num_const">1</span> );
<span class="lineno" id="24">    24  </span>		<span class="key">var</span> aB:Array = a.slice( nIndex, a.length - <span class="num_const">1</span> );
<span class="lineno" id="25">    25  </span>		aA.push( objElement );
<span class="lineno" id="26">    26  </span>		<span class="key">return</span> ArrayUtils.merge( aA, aB );
<span class="lineno" id="27">    27  </span>	}
<span class="lineno" id="28">    28  </span>
<span class="lineno" id="29">    29  </span>	<span class="comment doc">/**
<span class="lineno" id="30">    30  </span>	 * remove all instances of an element from an array
<span class="lineno" id="31">    31  </span>	 * @param a (Array)
<span class="lineno" id="32">    32  </span>	 * @param objElement (Object)
<span class="lineno" id="33">    33  </span>	 * @return Array
<span class="lineno" id="34">    34  </span>	 */</span>
<span class="lineno" id="35">    35  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> remove(a:Array, objElement:Object):Array {
<span class="lineno" id="36">    36  </span>		<span class="key">for</span>(<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; a.length ; i++) {
<span class="lineno" id="37">    37  </span>			<span class="key">if</span> (a[i] === objElement) {
<span class="lineno" id="38">    38  </span>				a.splice( i, <span class="num_const">1</span> );
<span class="lineno" id="39">    39  </span>			}
<span class="lineno" id="40">    40  </span>		}
<span class="lineno" id="41">    41  </span>		<span class="key">return</span> a;
<span class="lineno" id="42">    42  </span>	}
<span class="lineno" id="43">    43  </span>
<span class="lineno" id="44">    44  </span>	<span class="comment doc">/**
<span class="lineno" id="45">    45  </span>	 * search an array for a given element and return its index or null
<span class="lineno" id="46">    46  </span>	 * @param a (Array)
<span class="lineno" id="47">    47  </span>	 * @param objElement (Object)
<span class="lineno" id="48">    48  </span>	 * @return Number
<span class="lineno" id="49">    49  </span>	 */</span>	
<span class="lineno" id="50">    50  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> search(a:Array, objElement:Object):Number {
<span class="lineno" id="51">    51  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; a.length ; i++) {
<span class="lineno" id="52">    52  </span>			<span class="key">if</span> (a[i] === objElement) {
<span class="lineno" id="53">    53  </span>				<span class="key">return</span> i;
<span class="lineno" id="54">    54  </span>			}
<span class="lineno" id="55">    55  </span>		}
<span class="lineno" id="56">    56  </span>		<span class="key">return</span> <span class="key">null</span>;
<span class="lineno" id="57">    57  </span>	}
<span class="lineno" id="58">    58  </span>
<span class="lineno" id="59">    59  </span>	<span class="comment doc">/**
<span class="lineno" id="60">    60  </span>	 * shuffle array items
<span class="lineno" id="61">    61  </span>	 * @param a (Array)
<span class="lineno" id="62">    62  </span>	 * @return Void
<span class="lineno" id="63">    63  </span>	 */</span>
<span class="lineno" id="64">    64  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> shuffle(a:Array):Void {
<span class="lineno" id="65">    65  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; a.length ; i++) {
<span class="lineno" id="66">    66  </span>			<span class="key">var</span> tmp:Object = a[i];
<span class="lineno" id="67">    67  </span>			<span class="key">var</span> randomNum:Number = random( a.length );
<span class="lineno" id="68">    68  </span>			a[i] = a[randomNum];
<span class="lineno" id="69">    69  </span>			a[randomNum] = tmp;
<span class="lineno" id="70">    70  </span>		}
<span class="lineno" id="71">    71  </span>	}
<span class="lineno" id="72">    72  </span>
<span class="lineno" id="73">    73  </span>	<span class="comment doc">/**
<span class="lineno" id="74">    74  </span>	 * return a clone of the array
<span class="lineno" id="75">    75  </span>	 * @param a (Array)
<span class="lineno" id="76">    76  </span>	 * @return Array
<span class="lineno" id="77">    77  </span>	 */</span>
<span class="lineno" id="78">    78  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> clone(a:Array):Array {
<span class="lineno" id="79">    79  </span>		<span class="key">return</span> a.concat( );
<span class="lineno" id="80">    80  </span>	}
<span class="lineno" id="81">    81  </span>
<span class="lineno" id="82">    82  </span>	<span class="comment doc">/**
<span class="lineno" id="83">    83  </span>	 * merge two arrays into one
<span class="lineno" id="84">    84  </span>	 * @param aA (Array)
<span class="lineno" id="85">    85  </span>	 * @param aB (Array)
<span class="lineno" id="86">    86  </span>	 * @return Array
<span class="lineno" id="87">    87  </span>	 */</span>
<span class="lineno" id="88">    88  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> merge(aA:Array, aB:Array):Array {
<span class="lineno" id="89">    89  </span>		<span class="key">var</span> aC:Array = ArrayUtils.clone( aB );
<span class="lineno" id="90">    90  </span>		<span class="key">for</span>(<span class="key">var</span> i:Number = aA.length - <span class="num_const">1</span>; i &gt; -<span class="num_const">1</span> ; i--) {
<span class="lineno" id="91">    91  </span>			aC.unshift( aA[i] );
<span class="lineno" id="92">    92  </span>		}
<span class="lineno" id="93">    93  </span>		<span class="key">return</span> aC;
<span class="lineno" id="94">    94  </span>	}	
<span class="lineno" id="95">    95  </span>
<span class="lineno" id="96">    96  </span>	<span class="comment">// Swaps two elements at the given indexes of the subject array.</span>
<span class="lineno" id="97">    97  </span>	<span class="comment doc">/**
<span class="lineno" id="98">    98  </span>	 * Swap two elements positions in an array
<span class="lineno" id="99">    99  </span>	 * @param a (Array)
<span class="lineno" id="100">   100  </span>	 * @param nA (Number) element A's index
<span class="lineno" id="101">   101  </span>	 * @param nB (Number) element B's index
<span class="lineno" id="102">   102  </span>	 * @return Array
<span class="lineno" id="103">   103  </span>	 * @throws Error on invalid array index
<span class="lineno" id="104">   104  </span>	 */</span>
<span class="lineno" id="105">   105  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> swap(a:Array, nA:Number, nB:Number):Array {
<span class="lineno" id="106">   106  </span>		<span class="key">if</span> (nA &gt;= a.length || nA &lt; <span class="num_const">0</span>) {
<span class="lineno" id="107">   107  </span>			<span class="key">throw</span> <span class="key">new</span> Error( <span class="str_const">"@@@ com.sekati.utils.ArrayUtils.swap() Error: Index 'A' ("</span> + nA + <span class="str_const">") is not a valid index in the array '"</span> + a.toString( ) + <span class="str_const">"'."</span> );
<span class="lineno" id="108">   108  </span>			<span class="key">return</span> a;
<span class="lineno" id="109">   109  </span>		}
<span class="lineno" id="110">   110  </span>		<span class="key">if</span>(nB &gt;= a.length || nB &lt; <span class="num_const">0</span>) {
<span class="lineno" id="111">   111  </span>			<span class="key">throw</span> <span class="key">new</span> Error( <span class="str_const">"@@@ com.sekati.utils.ArrayUtils.swap() Error: Index 'A' ("</span> + nB + <span class="str_const">") is not a valid index in the array '"</span> + a.toString( ) + <span class="str_const">"'."</span> );
<span class="lineno" id="112">   112  </span>			<span class="key">return</span> a;
<span class="lineno" id="113">   113  </span>		}
<span class="lineno" id="114">   114  </span>		<span class="key">var</span> objElement:Object = a[nA];
<span class="lineno" id="115">   115  </span>		a[nA] = a[nB];
<span class="lineno" id="116">   116  </span>		a[nB] = objElement;
<span class="lineno" id="117">   117  </span>		<span class="key">return</span> a;
<span class="lineno" id="118">   118  </span>	}	
<span class="lineno" id="119">   119  </span>
<span class="lineno" id="120">   120  </span>	<span class="comment doc">/**
<span class="lineno" id="121">   121  </span>	 * Return alphabetically sorted array.
<span class="lineno" id="122">   122  </span>	 * @param a (Array)
<span class="lineno" id="123">   123  </span>	 * @return Array
<span class="lineno" id="124">   124  </span>	 */</span>
<span class="lineno" id="125">   125  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> asort(a:Array):Array {
<span class="lineno" id="126">   126  </span>		<span class="key">var</span> aFn:Function = <span class="key">function</span> (element1:String, element2:String):Boolean {
<span class="lineno" id="127">   127  </span>			<span class="key">return</span> element1.toUpperCase( ) &gt; element2.toUpperCase( );
<span class="lineno" id="128">   128  </span>		};
<span class="lineno" id="129">   129  </span>		<span class="key">return</span> a.sort( aFn );
<span class="lineno" id="130">   130  </span>	}
<span class="lineno" id="131">   131  </span>
<span class="lineno" id="132">   132  </span>	<span class="comment doc">/**
<span class="lineno" id="133">   133  </span>	 * return array with duplicate entries removed
<span class="lineno" id="134">   134  </span>	 * @param a (Array)
<span class="lineno" id="135">   135  </span>	 * @return Array
<span class="lineno" id="136">   136  </span>	 */</span>
<span class="lineno" id="137">   137  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> removeDuplicate(a:Array):Array {
<span class="lineno" id="138">   138  </span>		a.sort( );
<span class="lineno" id="139">   139  </span>		<span class="key">var</span> o:Array = <span class="key">new</span> Array( );
<span class="lineno" id="140">   140  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; a.length ; i++) {
<span class="lineno" id="141">   141  </span>			<span class="key">if</span> (a[i] != a[i + <span class="num_const">1</span>]) {
<span class="lineno" id="142">   142  </span>				o.push( a[i] );
<span class="lineno" id="143">   143  </span>			}
<span class="lineno" id="144">   144  </span>		}
<span class="lineno" id="145">   145  </span>		<span class="key">return</span> o;
<span class="lineno" id="146">   146  </span>	}
<span class="lineno" id="147">   147  </span>
<span class="lineno" id="148">   148  </span>	<span class="comment doc">/**
<span class="lineno" id="149">   149  </span>	 * compare two arrays for a matching value
<span class="lineno" id="150">   150  </span>	 * @param aA (Array)
<span class="lineno" id="151">   151  </span>	 * @param aB (Array)	
<span class="lineno" id="152">   152  </span>	 * @return Boolean
<span class="lineno" id="153">   153  </span>	 */</span>	
<span class="lineno" id="154">   154  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> matchValues(aA:Array, aB:Array):Boolean {
<span class="lineno" id="155">   155  </span>		<span class="key">for</span> (<span class="key">var</span> f:Number = <span class="num_const">0</span>; f &lt; aA.length ; f++) {
<span class="lineno" id="156">   156  </span>			<span class="key">for</span> (<span class="key">var</span> l:Number = <span class="num_const">0</span>; l &lt; aB.length ; l++) {
<span class="lineno" id="157">   157  </span>				<span class="key">if</span> (aB[l].toLowerCase( ) === aA[f].toLowerCase( )) {
<span class="lineno" id="158">   158  </span>					<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="159">   159  </span>				}
<span class="lineno" id="160">   160  </span>			}
<span class="lineno" id="161">   161  </span>		}
<span class="lineno" id="162">   162  </span>		<span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="163">   163  </span>	}
<span class="lineno" id="164">   164  </span>
<span class="lineno" id="165">   165  </span>	<span class="comment doc">/**
<span class="lineno" id="166">   166  </span>	 * compare two arrays to see if they are identical
<span class="lineno" id="167">   167  </span>	 * @param aA (Array)
<span class="lineno" id="168">   168  </span>	 * @param aB (Array)
<span class="lineno" id="169">   169  </span>	 * @return Boolean
<span class="lineno" id="170">   170  </span>	 */</span>
<span class="lineno" id="171">   171  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> compare(aA:Array, aB:Array):Boolean {
<span class="lineno" id="172">   172  </span>		<span class="key">if</span>(aA.length != aB.length) {
<span class="lineno" id="173">   173  </span>			<span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="174">   174  </span>		}
<span class="lineno" id="175">   175  </span>		<span class="key">for</span>(<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; aA.length ; i++) {
<span class="lineno" id="176">   176  </span>			<span class="key">if</span>(aA[i] !== aB[i]) {
<span class="lineno" id="177">   177  </span>				<span class="key">return</span> <span class="key">false</span>;
<span class="lineno" id="178">   178  </span>			}
<span class="lineno" id="179">   179  </span>		}
<span class="lineno" id="180">   180  </span>		<span class="key">return</span> <span class="key">true</span>;
<span class="lineno" id="181">   181  </span>	}
<span class="lineno" id="182">   182  </span>
<span class="lineno" id="183">   183  </span>	<span class="comment doc">/**
<span class="lineno" id="184">   184  </span>	 * Search for a specific value of a property in an array of objects
<span class="lineno" id="185">   185  </span>	 * @param objArr (Array) array of objects
<span class="lineno" id="186">   186  </span>	 * @param prop (String) property to search
<span class="lineno" id="187">   187  </span>	 * @param val (Object) value to locate
<span class="lineno" id="188">   188  </span>	 * @param isCaseInsensitive (Boolean) - define whether prop and val should be case-insensitive [default: false]
<span class="lineno" id="189">   189  </span>	 * @return Object - that matches property value
<span class="lineno" id="190">   190  </span>	 */</span>
<span class="lineno" id="191">   191  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> locatePropVal(objArr:Array, prop:String, val:Object, isCaseInsensitive:Boolean):Object {
<span class="lineno" id="192">   192  </span>		<span class="key">for</span>(<span class="key">var</span> o <span class="key">in</span> objArr) {
<span class="lineno" id="193">   193  </span>			<span class="key">if</span> (!isCaseInsensitive) {
<span class="lineno" id="194">   194  </span>				<span class="key">if</span> (objArr[o][prop] == val) <span class="key">return</span> objArr[o];
<span class="lineno" id="195">   195  </span>			} <span class="key">else</span> {
<span class="lineno" id="196">   196  </span>				<span class="key">if</span> (objArr[o][prop].toUpperCase( ) == val.toUpperCase( )) <span class="key">return</span> objArr[o];	
<span class="lineno" id="197">   197  </span>			}		
<span class="lineno" id="198">   198  </span>		}
<span class="lineno" id="199">   199  </span>		<span class="key">return</span> undefined;
<span class="lineno" id="200">   200  </span>	}	
<span class="lineno" id="201">   201  </span>
<span class="lineno" id="202">   202  </span>	<span class="comment doc">/**
<span class="lineno" id="203">   203  </span>	 * Search for a unique value property match and return its index in the array.
<span class="lineno" id="204">   204  </span>	 * @param a (Array) array of objects
<span class="lineno" id="205">   205  </span>	 * @param prop (String) property to search
<span class="lineno" id="206">   206  </span>	 * @param val (Object) value to locate
<span class="lineno" id="207">   207  </span>	 * @return Number - index of hit
<span class="lineno" id="208">   208  </span>	 */</span>
<span class="lineno" id="209">   209  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> locatePropValIndex(a:Array, prop:String, val:Object):Number {
<span class="lineno" id="210">   210  </span>		<span class="key">for</span> (<span class="key">var</span> i:Number = <span class="num_const">0</span>; i &lt; a.length ; i++) {
<span class="lineno" id="211">   211  </span>			<span class="key">if</span>(a[i][prop] == val) {
<span class="lineno" id="212">   212  </span>				<span class="key">return</span> i;	
<span class="lineno" id="213">   213  </span>			}
<span class="lineno" id="214">   214  </span>		}	
<span class="lineno" id="215">   215  </span>	}
<span class="lineno" id="216">   216  </span>
<span class="lineno" id="217">   217  </span>	<span class="comment doc">/**
<span class="lineno" id="218">   218  </span>	 * Return a new array sliced from original array based on a value property match
<span class="lineno" id="219">   219  </span>	 * @param objArr (Array) array of objects
<span class="lineno" id="220">   220  </span>	 * @param prop (String) property to search
<span class="lineno" id="221">   221  </span>	 * @param val (Object) value to locate
<span class="lineno" id="222">   222  </span>	 * @param isCaseInsensitive (Boolean) - define whether prop and val should be case-insensitive [default: false]
<span class="lineno" id="223">   223  </span>	 * @return Array - array of objects that matches property value
<span class="lineno" id="224">   224  </span>	 */</span>
<span class="lineno" id="225">   225  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> sliceByPropVal(objArr:Array, prop:String, val:Object, isCaseInsensitive:Boolean):Array {
<span class="lineno" id="226">   226  </span>		<span class="key">var</span> a:Array = <span class="key">new</span> Array( );
<span class="lineno" id="227">   227  </span>		<span class="key">for</span>(<span class="key">var</span> o <span class="key">in</span> objArr) {
<span class="lineno" id="228">   228  </span>			<span class="key">if</span> (!isCaseInsensitive) {
<span class="lineno" id="229">   229  </span>				<span class="key">if</span> (objArr[o][prop] == val) a.push( objArr[o] );
<span class="lineno" id="230">   230  </span>			} <span class="key">else</span> {
<span class="lineno" id="231">   231  </span>				<span class="key">if</span> (objArr[o][prop].toUpperCase( ) == val.toUpperCase( )) a.push( objArr[o] );	
<span class="lineno" id="232">   232  </span>			}
<span class="lineno" id="233">   233  </span>		}
<span class="lineno" id="234">   234  </span>		<span class="key">return</span> a;	
<span class="lineno" id="235">   235  </span>	}	
<span class="lineno" id="236">   236  </span>
<span class="lineno" id="237">   237  </span>	<span class="comment doc">/**
<span class="lineno" id="238">   238  </span>	 * Return the index of the minimum value in a numeric array
<span class="lineno" id="239">   239  </span>	 * @param a (Array)
<span class="lineno" id="240">   240  </span>	 * @return Number - minimum value
<span class="lineno" id="241">   241  </span>	 */</span>
<span class="lineno" id="242">   242  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> min(a:Array):Number {
<span class="lineno" id="243">   243  </span>		<span class="key">var</span> i:Number = a.length;
<span class="lineno" id="244">   244  </span>		<span class="key">var</span> min:Number = a[<span class="num_const">0</span>];
<span class="lineno" id="245">   245  </span>		<span class="key">var</span> idx:Number = <span class="num_const">0</span>;
<span class="lineno" id="246">   246  </span>		<span class="key">while</span> (i-- &gt; <span class="num_const">1</span>) {
<span class="lineno" id="247">   247  </span>			<span class="key">if</span>(a[i] &lt; min) min = a[idx = i];
<span class="lineno" id="248">   248  </span>		}
<span class="lineno" id="249">   249  </span>		<span class="key">return</span> idx;
<span class="lineno" id="250">   250  </span>	}
<span class="lineno" id="251">   251  </span>
<span class="lineno" id="252">   252  </span>	<span class="comment doc">/**
<span class="lineno" id="253">   253  </span>	 * Return the index of the maximum value in a numeric array
<span class="lineno" id="254">   254  </span>	 * @param a (Array)
<span class="lineno" id="255">   255  </span>	 * @return Number - maximum value
<span class="lineno" id="256">   256  </span>	 */</span>	
<span class="lineno" id="257">   257  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> max(a:Array):Number {
<span class="lineno" id="258">   258  </span>		<span class="key">var</span> i:Number = a.length;
<span class="lineno" id="259">   259  </span>		<span class="key">var</span> max:Number = a[<span class="num_const">0</span>];
<span class="lineno" id="260">   260  </span>		<span class="key">var</span> idx:Number = <span class="num_const">0</span>;	
<span class="lineno" id="261">   261  </span>		<span class="key">while</span>(i-- &gt; <span class="num_const">1</span>) {
<span class="lineno" id="262">   262  </span>			<span class="key">if</span>(a[i] &gt; max) max = a[idx = i];
<span class="lineno" id="263">   263  </span>		}
<span class="lineno" id="264">   264  </span>		<span class="key">return</span> idx;	
<span class="lineno" id="265">   265  </span>	}
<span class="lineno" id="266">   266  </span>
<span class="lineno" id="267">   267  </span>	<span class="comment doc">/**
<span class="lineno" id="268">   268  </span>	 * Return the minimum value in a numeric array
<span class="lineno" id="269">   269  </span>	 * @param a (Array)
<span class="lineno" id="270">   270  </span>	 * @return Number - minimum value (0 is returned with 0 length array)
<span class="lineno" id="271">   271  </span>	 */</span>	
<span class="lineno" id="272">   272  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> minVal(a:Array):Number {
<span class="lineno" id="273">   273  </span>		<span class="key">return</span> ((a.length &lt;= <span class="num_const">0</span>) ? <span class="num_const">0</span> : a[ArrayUtils.max( a )]);
<span class="lineno" id="274">   274  </span>	}
<span class="lineno" id="275">   275  </span>
<span class="lineno" id="276">   276  </span>	<span class="comment doc">/**
<span class="lineno" id="277">   277  </span>	 * Return the maximum value in a numeric array
<span class="lineno" id="278">   278  </span>	 * @param a (Array)
<span class="lineno" id="279">   279  </span>	 * @return Number - maximum value
<span class="lineno" id="280">   280  </span>	 */</span>	
<span class="lineno" id="281">   281  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> maxVal(a:Array):Number {
<span class="lineno" id="282">   282  </span>		<span class="key">return</span> ((a[ArrayUtils.max( a )] &lt; <span class="num_const">0</span>) ? <span class="num_const">0</span> : a[ArrayUtils.max( a )]);
<span class="lineno" id="283">   283  </span>	}
<span class="lineno" id="284">   284  </span>
<span class="lineno" id="285">   285  </span>	<span class="key">private</span> <span class="key">function</span> ArrayUtils() {
<span class="lineno" id="286">   286  </span>	}
<span class="lineno" id="287">   287  </span>}</pre><ul class="main_nav" id="main_nav"><li><a href="../../../overview-summary.html" title="Overview of SASAPI" class="button">Overview</a></li><li><a href="package-summary.html" title="Overview of package com.sekati.utils" class="button">Package</a></li><li><a href="ArrayUtils.html" title="Detail of com.sekati.utils.ArrayUtils API" class="button">Class</a></li><li><span class="button nav_current">Source</span></li><li><a href="../../../index-files/index.html" title="Alpabetical index of types and members" class="button">Index</a></li></ul><div class="footer"><a href="http://www.badgers-in-foil.co.uk/projects/as2api/" title="ActionScript 2 API Documentation Generator">as2api</a></div></body></html>